package lianxiti;

import com.sun.xml.internal.fastinfoset.util.CharArray;

import java.util.Arrays;

public class Lianxiti {
    public static void main(String[] args) {
        String str="654adsf561sd2f1a";
        fn(str);
        f(str);
    }
    public static void f(String str){
        str=str.replaceAll("[a-z]+","");
        String[] charArray=str.split("");
        // char[] charArray=str.toCharArray();
        Arrays.sort(charArray);
        System.out.println(Arrays.toString(charArray));
    }
    public static void fn(String str){
        char[] CharArray=str.toCharArray();
        char[] charNew={};
        for (int i=0;i<CharArray.length;i++){
            if (CharArray[i]>='1'&&CharArray[i]<='9'){
                charNew= Arrays.copyOf(charNew,charNew.length+1);
                charNew[charNew.length-1]=CharArray[i];
            }
        }
        Arrays.sort(charNew);
        System.out.println(charNew);

    }
}
